<?php

/*

  Action	$2

  +3 Cards
  Put a card from your hand on top of your deck.

 */

class Courtyard extends Card implements iAction, iKingdom, iIntrigue {

    public function __construct() {
        parent::__construct("Courtyard", 2);
        $this->undoPlay = false;
        $this->undoBuy = true;
    }

    public function getDescription() {
        return array(
            "+3 Cards",
            "Put a card from your hand on top of your deck.");
    }
    
    public function play(Game $game, $isRealCard) {
        $drawed_cards = $game->drawCards(3);
        ScreenDisplay::addScreenMessage($game, false, ", draw ". nicePrint($drawed_cards), ", draws ".sizeof($drawed_cards). " cards");
        
        $playHand = $game->getPlayHand();
        if (sizeof($playHand) > 0) {
            
            $output = MySocket::GetUserReply($game,  Input_ChooseOne, $playHand, 1, 1, null, "Choose cards to return to draw deck");
            $card_name = $output[0];
            $card = $game->moveCardFromPileToPile($card_name, PlayHand, DrawPile);
			ScreenDisplay::addScreenMessage($game, false, " and return ".  nicePrint($card). " on your deck"," and returns 1 cards back to his deck");

        }

        $game->cardActionFinished();
        return true;
    }
}

?>